package au.com.handsunited.model.validators.availability;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import au.com.handsunited.model.Availability;
import au.com.handsunited.model.Availability;

/**
 * @author Object
 *
 */
public class AvailabilityValidator implements Validator {


	private static Logger logger = LoggerFactory.getLogger(AvailabilityValidator.class);


	/**
	 * @see org.springframework.validation.Validator#supports(java.lang.Class)
	 */
	@Override
	public boolean supports(Class clazz) {
		return clazz.isAssignableFrom(Availability.class);
	}

	/**
	 * @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
	 */
	@Override
	public void validate(Object target, Errors errors) {

		Availability availability = (Availability) target;

		//	either between certain dates or all year round
		if (availability.isAlwaysAvailable()) {
			//	start and end dates are left blank
		} else {
			//	start and end dates are entered and startdate < enddate
		}


	}

}
